package com.leilbase.authshiro.auth.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.leilbase.authshiro.auth.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Leil
 * @since 2019-07-23
 */
public interface UserMapper extends BaseMapper<User> {

    @Select("SELECT role.role as role,permission.permission as permission FROM user INNER JOIN role ON user.name=role.user_name INNER JOIN permission ON role.role=permission.role_name ${ew.customSqlSegment}")
    List<Map<String, Object>> selectUserRolePermissionMaps(@Param("ew") Wrapper<User> queryWrapper);

}
